<?php

namespace app\model;



// CREATE TABLE `teacher` (
//   `id` int(11) NOT NULL AUTO_INCREMENT,
//   `created_at` int(11) NOT NULL COMMENT '创建时间',
//   `updated_at` int(11) NOT NULL COMMENT '更新时间',
//   `name` varchar(255) NOT NULL COMMENT '姓名' DEFAULT '',
//   `avatar` varchar(255) NOT NULL COMMENT '头像' DEFAULT '',
//   `content` text NOT NULL COMMENT '内容',
//   `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态 1正常 0禁用',
//   `weight` int(11) NOT NULL DEFAULT '0' COMMENT '权重',
//   PRIMARY KEY (`id`)
// ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='教师';

class Teacher extends Base
{

     protected $pk = 'id';
    protected $autoWriteTimestamp = true;
    protected $createTime = 'created_at';
    protected $updateTime = 'updated_at';


    public function listQuery(string|array $where = '')
    {
        return $this->where($where)->field('*')->order("weight desc")->paginate(input('limit/d'));
    }

       /**
     * 列表
     * @param  string/array  $where  查询条件
     * @param  string        $field  查询的字段
     * @return array
     */
    public function listArray(string|array $where = '', string $field = '*')
    {
        return $this->where($where)->column($field);
    }

}